<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>05 goodslist</title>
    <script src="./js/vue.js"></script>
    <script src="./js/axios.min.js"></script>
    <style>
        *{
            padding: 0;
            margin: 0;
            list-style: none;
        }
        .table{
            margin: 20px auto;
            width: 1200px;
        }
        .table .item{
            margin-right: 20px;
            width: 200px;
            height: 300px;
            float: left;
        }
        .table .item .img{
            width: 200px;
            height: 200px;
        }

    </style>
</head>
<body>
    <div id="app">
        <div class="table">
            <div class="item" v-for="item in list" :key="item.id">
                <img :src="item.goodsimg" alt="" class="img">
                <p>商品名称：{{item.goodsname}}</p>
                <p class="num">数量{{item.goodsnum}}</p>
                <p class="price">价格{{item.goodsprice}}</p>
            </div>
        </div>

    </div>
    
</body>
<script>
    new Vue({
        el:"#app",
        data:{
            list:[],

        },
        async created(){
            let {data:list} = await axios({
                method:"get",
                url:"http://localhost:2345/goodslist",

            })
            this.list = list;

        },
        methods:{

        },
        watch:{

        }
    })
</script>
</html>